/* eslint-disable */
import { observable, action, runInAction,makeObservable,makeAutoObservable } from 'mobx'
import { login,register } from '@/api/login'
import { queryMessageCount } from '@/api/message'
import Cookies from 'js-cookie'

class Store {

  constructor(){
    
    makeAutoObservable(this)

  }

  @observable loadingText = '正在加载'
  // 获取数据源
  @action Login = async (params = {}, callback) => {
    try {
      runInAction(async () => {
     let res = await login(params)
     if(res.code == 200){
         this.userInfo = res.userInfo;
         Cookies.set('userInfo',res.userInfo)
         this.loginStatus = true 
     }
      callback(res)
      })
    } catch (error) {
      
    }
  }

 
}
export default new Store()
